<template>
  <div>
    <el-row :gutter="20">
      <el-col :span="12" v-for="(item, index) in group" :key="index">
        <el-card shadow="hover">
          <div class="goods">
            <span>{{ item.title }}</span>
            <span>
              <el-link
                :underline="false"
                @click="$router.push({ path: `/1688/follow/list/${item.id}` })"
              >
                查看分组商品列表
                <i class="el-icon-s-promotion"></i>
              </el-link>
            </span>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return { group: [] };
  },
  methods: {
    async getGroup(index = 1) {
      await this.$http
        .post(
          `/select-goods/get-select-goods-group/${index}`
        )
        .then((res) => {
          if (res.data.code == 403) {
            this.$message({
              message: "网络错误【" + res.data.message + "】",
              type: "warning",
            });
          } else {
            let message = JSON.parse(res.data.message);
            this.group = message.result.result;
          }
        });
    },
  },
  created() {
    this.getGroup();
  },
};
</script>
<style scoped>
.goods {
  display: flex;
  justify-content: space-between;
}
</style>
